home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / libIDL-1.0 / libIDL / IDL.h
Encoding:
C/C++ Source or Header  |  2005-10-20  |  23.4 KB  |  854 lines

  1. /**************************************************************************
  2.  
  3.     IDL.h (IDL parse tree and namespace components)
  4.  
  5.     Copyright (C) 1998, 1999 Andrew T. Veliath
  6.  
  7.     This library is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU Library General Public
  9.     License as published by the Free Software Foundation; either
  10.     version 2 of the License, or (at your option) any later version.
  11.  
  12.     This library is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.     Library General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU Library General Public
  18.     License along with this library; if not, write to the Free
  19.     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.     $Id: IDL.h.new.in,v 1.21.4.1 2000/12/12 01:23:55 mathieu Exp $
  22.  
  23. ***************************************************************************/
  24. #ifndef __IDL_H
  25. #define __IDL_H
  26.  
  27. #include <glib.h>
  28.  
  29. /* Try to find wchar_t support */
  30. #include <stdlib.h>
  31. #if 1 /* HAVE_WCHAR_H */
  32. #  include <wchar.h>
  33. #endif
  34. #if 0 /* HAVE_WCSTR_H */
  35. #  include <wcstr.h>
  36. #endif
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42. #include <stdio.h>
  43.  
  44. /* version */
  45. #define LIBIDL_VERSION(a,b,c)        (((a) << 16) + ((b) << 8) + (c))
  46. #define LIBIDL_MAJOR_VERSION        0
  47. #define LIBIDL_MINOR_VERSION        6
  48. #define LIBIDL_MICRO_VERSION        8
  49. #define LIBIDL_VERSION_CODE        LIBIDL_VERSION(0,6,8)
  50.  
  51. /* miscellaneous constants */
  52. #define IDL_SUCCESS            0
  53. #define IDL_ERROR            1
  54. #define IDL_WARNING1            2
  55. #define IDL_WARNING2            3
  56. #define IDL_WARNING3            4
  57. #define IDL_WARNINGMAX            IDL_WARNING3
  58.  
  59. /* general parse flags */
  60. #define IDLF_VERBOSE            (1UL << 0)
  61. #define IDLF_NO_EVAL_CONST        (1UL << 1)
  62. #define IDLF_COMBINE_REOPENED_MODULES    (1UL << 2)
  63. #define IDLF_PREFIX_FILENAME        (1UL << 3)
  64. #define IDLF_IGNORE_FORWARDS        (1UL << 4)
  65. #define IDLF_PEDANTIC            (1UL << 5)
  66. #define IDLF_INHIBIT_TAG_ONLY        (1UL << 6)
  67. #define IDLF_INHIBIT_INCLUDES        (1UL << 7)
  68.  
  69. /* syntax extension parse flags */
  70. #define IDLF_TYPECODES            (1UL << 16)
  71. #define IDLF_XPIDL            (1UL << 17)
  72. #define IDLF_PROPERTIES            (1UL << 18)
  73. #define IDLF_CODEFRAGS            (1UL << 19)
  74.  
  75. /* declaration specification flags */
  76. #define IDLF_DECLSPEC_EXIST        (1UL << 0)
  77. #define IDLF_DECLSPEC_INHIBIT        (1UL << 1)
  78.  
  79. /* output flags */
  80. #define IDLF_OUTPUT_NO_NEWLINES        (1UL << 0)
  81. #define IDLF_OUTPUT_NO_QUALIFY_IDENTS    (1UL << 1)
  82. #define IDLF_OUTPUT_PROPERTIES        (1UL << 2)
  83. #define IDLF_OUTPUT_CODEFRAGS        (1UL << 3)
  84.  
  85. #ifdef _WIN32
  86. #  define IDL_EXPORT            __declspec (dllexport)
  87. #  define IDL_IMPORT            __declspec (dllimport)
  88. #else
  89. #  define IDL_EXPORT            /* empty */
  90. #  define IDL_IMPORT            extern
  91. #endif
  92.  
  93. /* type casting checks */
  94. #define IDL_check_cast_enable(boolean)    do {    \
  95.     IDL_IMPORT int __IDL_check_type_casts;    \
  96.     __IDL_check_type_casts = (boolean);    \
  97. } while (0)
  98. #define IDL_CHECK_CAST(tree, thetype, name)            \
  99.     (IDL_check_type_cast(tree, thetype,            \
  100.                 __FILE__, __LINE__,            \
  101.                 G_GNUC_PRETTY_FUNCTION)->u.name)
  102.  
  103. #ifdef G_HAVE_GINT64
  104. #  if G_MAXLONG > 0xffffffffUL
  105. #    define IDL_LL            "l"
  106. #  else
  107. #    define IDL_LL            "ll"
  108. #  endif
  109. typedef gint64                IDL_longlong_t;
  110. typedef guint64                IDL_ulonglong_t;
  111. #else
  112. #  define IDL_LL            "l"
  113. typedef long                IDL_longlong_t;
  114. typedef unsigned long            IDL_ulonglong_t;
  115. #  warning 64-bit integer type not available, using 32-bit instead
  116. #endif /* G_HAVE_GINT64 */
  117.  
  118. typedef unsigned int            IDL_declspec_t;
  119. typedef struct _IDL_tree_node         IDL_tree_node;
  120. typedef struct _IDL_tree_node *        IDL_tree;
  121.  
  122. struct _IDL_LIST {
  123.     IDL_tree data;
  124.     IDL_tree prev;
  125.     IDL_tree next;
  126.     IDL_tree _tail;            /* Internal use, may not be valid */
  127. };
  128.   
  129. #define IDL_LIST(a)            IDL_CHECK_CAST(a, IDLN_LIST, idl_list)
  130. extern IDL_tree        IDL_list_new            (IDL_tree data);
  131. extern IDL_tree        IDL_list_concat            (IDL_tree orig,
  132.                              IDL_tree append);
  133. extern IDL_tree        IDL_list_remove            (IDL_tree list,
  134.                              IDL_tree p);
  135. extern int        IDL_list_length            (IDL_tree list);
  136. extern IDL_tree        IDL_list_nth            (IDL_tree list,
  137.                              int n);
  138.  
  139. struct _IDL_GENTREE {
  140.     IDL_tree data;
  141.     GHashTable *siblings;
  142.     GHashTable *children;
  143.     GHashFunc hash_func;
  144.     GCompareFunc key_compare_func;
  145.     IDL_tree _import;        /* Internal use, do not recurse */
  146.     char *_cur_prefix;        /* Internal use */
  147. };
  148. #define IDL_GENTREE(a)            IDL_CHECK_CAST(a, IDLN_GENTREE, idl_gentree)
  149. extern IDL_tree        IDL_gentree_new            (GHashFunc hash_func,
  150.                              GCompareFunc key_compare_func,
  151.                              IDL_tree data);
  152. extern IDL_tree        IDL_gentree_new_sibling        (IDL_tree from,
  153.                              IDL_tree data);
  154. extern IDL_tree        IDL_gentree_chain_sibling    (IDL_tree from,
  155.                              IDL_tree data);
  156. extern IDL_tree        IDL_gentree_chain_child        (IDL_tree from,
  157.                              IDL_tree data);
  158.  
  159. struct _IDL_INTEGER {
  160.     IDL_longlong_t value;
  161. };
  162. #define IDL_INTEGER(a)            IDL_CHECK_CAST(a, IDLN_INTEGER, idl_integer)
  163. extern IDL_tree        IDL_integer_new            (IDL_longlong_t value);
  164.  
  165. struct _IDL_STRING {
  166.     char *value;
  167. };
  168. #define IDL_STRING(a)            IDL_CHECK_CAST(a, IDLN_STRING, idl_string)
  169. extern IDL_tree        IDL_string_new            (char *value);
  170.  
  171. struct _IDL_WIDE_STRING {
  172.     wchar_t *value;
  173. };
  174. #define IDL_WIDE_STRING(a)        IDL_CHECK_CAST(a, IDLN_WIDE_STRING, idl_wide_string)
  175. extern IDL_tree        IDL_wide_string_new        (wchar_t *value);
  176.  
  177. struct _IDL_CHAR {
  178.     char *value;
  179. };
  180. #define IDL_CHAR(a)            IDL_CHECK_CAST(a, IDLN_CHAR, idl_char)
  181. extern IDL_tree        IDL_char_new            (char *value);
  182.  
  183. struct _IDL_WIDE_CHAR {
  184.     wchar_t *value;
  185. };
  186. #define IDL_WIDE_CHAR(a)        IDL_CHECK_CAST(a, IDLN_WIDE_CHAR, idl_wide_char)
  187. extern IDL_tree        IDL_wide_char_new        (wchar_t *value);
  188.  
  189. struct _IDL_FIXED {
  190.     char *value;
  191. };
  192. #define IDL_FIXED(a)            IDL_CHECK_CAST(a, IDLN_FIXED, idl_fixed)
  193. extern IDL_tree        IDL_fixed_new            (char *value);
  194.  
  195. struct _IDL_FLOAT {
  196.     double value;
  197. };
  198. #define IDL_FLOAT(a)            IDL_CHECK_CAST(a, IDLN_FLOAT, idl_float)
  199. extern IDL_tree        IDL_float_new            (double value);
  200.  
  201. struct _IDL_BOOLEAN {
  202.     unsigned value;
  203. };
  204. #define IDL_BOOLEAN(a)            IDL_CHECK_CAST(a, IDLN_BOOLEAN, idl_boolean)
  205. extern IDL_tree        IDL_boolean_new            (unsigned value);
  206.  
  207. struct _IDL_IDENT {
  208.     char *str;
  209.     char *repo_id;
  210.     GSList *comments;
  211.     IDL_tree _ns_ref;        /* Internal use, do not recurse */
  212.     unsigned _flags;        /* Internal use */
  213. #define IDLF_IDENT_CASE_MISMATCH_HIT    (1UL << 0)
  214. };
  215. #define IDL_IDENT(a)            IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident)
  216. #define IDL_IDENT_TO_NS(a)        IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident._ns_ref)
  217. #define IDL_IDENT_REPO_ID(a)        IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident.repo_id)
  218. extern IDL_tree        IDL_ident_new            (char *str);
  219. extern void        IDL_queue_new_ident_comment    (const char *str);
  220.  
  221. enum IDL_float_type {
  222.     IDL_FLOAT_TYPE_FLOAT,
  223.     IDL_FLOAT_TYPE_DOUBLE,
  224.     IDL_FLOAT_TYPE_LONGDOUBLE
  225. };
  226.  
  227. struct _IDL_TYPE_FLOAT {
  228.     enum IDL_float_type f_type;
  229. };
  230. #define IDL_TYPE_FLOAT(a)        IDL_CHECK_CAST(a, IDLN_TYPE_FLOAT, idl_type_float)
  231. extern IDL_tree        IDL_type_float_new        (enum IDL_float_type f_type);
  232.  
  233. struct _IDL_TYPE_FIXED {
  234.     IDL_tree positive_int_const;
  235.     IDL_tree integer_lit;
  236. };
  237. #define IDL_TYPE_FIXED(a)        IDL_CHECK_CAST(a, IDLN_TYPE_FIXED, idl_type_fixed)
  238. extern IDL_tree        IDL_type_fixed_new        (IDL_tree positive_int_const,
  239.                              IDL_tree integer_lit);
  240.  
  241. enum IDL_integer_type {
  242.     IDL_INTEGER_TYPE_SHORT,
  243.     IDL_INTEGER_TYPE_LONG,
  244.     IDL_INTEGER_TYPE_LONGLONG
  245. };
  246.  
  247. struct _IDL_TYPE_INTEGER {
  248.     unsigned f_signed        : 1;
  249.     enum IDL_integer_type f_type;
  250. };
  251. #define IDL_TYPE_INTEGER(a)        IDL_CHECK_CAST(a, IDLN_TYPE_INTEGER, idl_type_integer)
  252. extern IDL_tree        IDL_type_integer_new        (unsigned f_signed,
  253.                              enum IDL_integer_type f_type);
  254.  
  255. extern IDL_tree        IDL_type_char_new        (void);
  256. extern IDL_tree        IDL_type_wide_char_new        (void);
  257. extern IDL_tree        IDL_type_boolean_new        (void);
  258. extern IDL_tree        IDL_type_octet_new        (void);
  259. extern IDL_tree        IDL_type_any_new        (void);
  260. extern IDL_tree        IDL_type_object_new        (void);
  261. extern IDL_tree        IDL_type_typecode_new        (void);
  262.  
  263. struct _IDL_TYPE_STRING {
  264.     IDL_tree positive_int_const;
  265. };
  266. #define IDL_TYPE_STRING(a)        IDL_CHECK_CAST(a, IDLN_TYPE_STRING, idl_type_string)
  267. extern IDL_tree        IDL_type_string_new        (IDL_tree positive_int_const);
  268.  
  269. struct _IDL_TYPE_WIDE_STRING {
  270.     IDL_tree positive_int_const;
  271. };
  272. #define IDL_TYPE_WIDE_STRING(a)        IDL_CHECK_CAST(a, IDLN_TYPE_WIDE_STRING, idl_type_wide_string)
  273. extern IDL_tree        IDL_type_wide_string_new    (IDL_tree positive_int_const);
  274.  
  275. struct _IDL_TYPE_ENUM {
  276.     IDL_tree ident;
  277.     IDL_tree enumerator_list;
  278. };
  279. #define IDL_TYPE_ENUM(a)        IDL_CHECK_CAST(a, IDLN_TYPE_ENUM, idl_type_enum)
  280. extern IDL_tree        IDL_type_enum_new        (IDL_tree ident,
  281.                              IDL_tree enumerator_list);
  282.  
  283. struct _IDL_TYPE_ARRAY {
  284.     IDL_tree ident;
  285.     IDL_tree size_list;
  286. };
  287. #define IDL_TYPE_ARRAY(a)        IDL_CHECK_CAST(a, IDLN_TYPE_ARRAY, idl_type_array)
  288. extern IDL_tree        IDL_type_array_new        (IDL_tree ident,
  289.                              IDL_tree size_list);
  290.  
  291. struct _IDL_TYPE_SEQUENCE {
  292.     IDL_tree simple_type_spec;
  293.     IDL_tree positive_int_const;
  294. };
  295. #define IDL_TYPE_SEQUENCE(a)        IDL_CHECK_CAST(a, IDLN_TYPE_SEQUENCE, idl_type_sequence)
  296. extern IDL_tree        IDL_type_sequence_new        (IDL_tree simple_type_spec,
  297.                              IDL_tree positive_int_const);
  298.  
  299. struct _IDL_TYPE_STRUCT {
  300.     IDL_tree ident;
  301.     IDL_tree member_list;
  302. };
  303. #define IDL_TYPE_STRUCT(a)        IDL_CHECK_CAST(a, IDLN_TYPE_STRUCT, idl_type_struct)
  304. extern IDL_tree        IDL_type_struct_new        (IDL_tree ident,
  305.                              IDL_tree member_list);
  306.  
  307. struct _IDL_TYPE_UNION {
  308.     IDL_tree ident;
  309.     IDL_tree switch_type_spec;
  310.     IDL_tree switch_body;
  311. };
  312. #define IDL_TYPE_UNION(a)        IDL_CHECK_CAST(a, IDLN_TYPE_UNION, idl_type_union)
  313. extern IDL_tree        IDL_type_union_new        (IDL_tree ident,
  314.                              IDL_tree switch_type_spec,
  315.                              IDL_tree switch_body);
  316. struct _IDL_MEMBER {
  317.     IDL_tree type_spec;
  318.     IDL_tree dcls;
  319. };
  320. #define IDL_MEMBER(a)            IDL_CHECK_CAST(a, IDLN_MEMBER, idl_member)
  321. extern IDL_tree        IDL_member_new            (IDL_tree type_spec,
  322.                              IDL_tree dcls);
  323.  
  324. struct _IDL_NATIVE {
  325.     IDL_tree ident;
  326.     char *user_type;        /* XPIDL extension */
  327. };
  328. #define IDL_NATIVE(a)            IDL_CHECK_CAST(a, IDLN_NATIVE, idl_native)
  329. extern IDL_tree        IDL_native_new            (IDL_tree ident);
  330.  
  331.  
  332. struct _IDL_TYPE_DCL {
  333.     IDL_tree type_spec;
  334.     IDL_tree dcls;
  335. };
  336. #define IDL_TYPE_DCL(a)            IDL_CHECK_CAST(a, IDLN_TYPE_DCL, idl_type_dcl)
  337. extern IDL_tree        IDL_type_dcl_new        (IDL_tree type_spec,
  338.                              IDL_tree dcls);
  339.  
  340. struct _IDL_CONST_DCL {
  341.     IDL_tree const_type;
  342.     IDL_tree ident;
  343.     IDL_tree const_exp;
  344. };
  345. #define IDL_CONST_DCL(a)        IDL_CHECK_CAST(a, IDLN_CONST_DCL, idl_const_dcl)
  346. extern IDL_tree        IDL_const_dcl_new        (IDL_tree const_type,
  347.                              IDL_tree ident,
  348.                              IDL_tree const_exp);
  349.  
  350. struct _IDL_EXCEPT_DCL {
  351.     IDL_tree ident;
  352.     IDL_tree members;
  353. };
  354. #define IDL_EXCEPT_DCL(a)        IDL_CHECK_CAST(a, IDLN_EXCEPT_DCL, idl_except_dcl)
  355. extern IDL_tree        IDL_except_dcl_new        (IDL_tree ident,
  356.                              IDL_tree members);
  357.  
  358. struct _IDL_ATTR_DCL {
  359.     unsigned f_readonly        : 1;
  360.     IDL_tree param_type_spec;
  361.     IDL_tree simple_declarations;
  362. };
  363. #define IDL_ATTR_DCL(a)            IDL_CHECK_CAST(a, IDLN_ATTR_DCL, idl_attr_dcl)
  364. extern IDL_tree        IDL_attr_dcl_new        (unsigned f_readonly,
  365.                              IDL_tree param_type_spec,
  366.                              IDL_tree simple_declarations);
  367.  
  368. struct _IDL_OP_DCL {
  369.     unsigned __f_noscript        : 1;    /* Deprecated */
  370.     unsigned f_oneway        : 1;
  371.     /* XPIDL extension (varags) */
  372.     unsigned f_varargs        : 1;
  373.     IDL_tree op_type_spec;
  374.     IDL_tree ident;
  375.     IDL_tree parameter_dcls;
  376.     IDL_tree raises_expr;
  377.     IDL_tree context_expr;
  378. };
  379. #define IDL_OP_DCL(a)            IDL_CHECK_CAST(a, IDLN_OP_DCL, idl_op_dcl)
  380. extern IDL_tree        IDL_op_dcl_new            (unsigned f_oneway,
  381.                              IDL_tree op_type_spec,
  382.                              IDL_tree ident,
  383.                              IDL_tree parameter_dcls,
  384.                              IDL_tree raises_expr,
  385.                              IDL_tree context_expr);
  386.  
  387. enum IDL_param_attr {
  388.     IDL_PARAM_IN,
  389.     IDL_PARAM_OUT,
  390.     IDL_PARAM_INOUT
  391. };
  392.  
  393. struct _IDL_PARAM_DCL {
  394.     enum IDL_param_attr attr;
  395.     IDL_tree param_type_spec;
  396.     IDL_tree simple_declarator;
  397. };
  398. #define IDL_PARAM_DCL(a)        IDL_CHECK_CAST(a, IDLN_PARAM_DCL, idl_param_dcl)
  399. extern IDL_tree        IDL_param_dcl_new        (enum IDL_param_attr attr,
  400.                              IDL_tree param_type_spec,
  401.                              IDL_tree simple_declarator);
  402.  
  403. struct _IDL_CASE_STMT {
  404.     IDL_tree labels;
  405.     IDL_tree element_spec;
  406. };
  407. #define IDL_CASE_STMT(a)        IDL_CHECK_CAST(a, IDLN_CASE_STMT, idl_case_stmt)
  408. extern IDL_tree        IDL_case_stmt_new        (IDL_tree labels,
  409.                              IDL_tree element_spec);
  410.  
  411. struct _IDL_INTERFACE {
  412.     IDL_tree ident;
  413.     IDL_tree inheritance_spec;
  414.     IDL_tree body;
  415. };
  416. #define IDL_INTERFACE(a)        IDL_CHECK_CAST(a, IDLN_INTERFACE, idl_interface)
  417. extern IDL_tree        IDL_interface_new        (IDL_tree ident,
  418.                              IDL_tree inheritance_spec,
  419.                              IDL_tree body);
  420.  
  421. struct _IDL_FORWARD_DCL {
  422.     IDL_tree ident;
  423. };
  424. #define IDL_FORWARD_DCL(a)        IDL_CHECK_CAST(a, IDLN_FORWARD_DCL, idl_forward_dcl)
  425. extern IDL_tree        IDL_forward_dcl_new        (IDL_tree ident);
  426.  
  427. struct _IDL_MODULE {
  428.     IDL_tree ident;
  429.     IDL_tree definition_list;
  430. };
  431. #define IDL_MODULE(a)            IDL_CHECK_CAST(a, IDLN_MODULE, idl_module)
  432. extern IDL_tree        IDL_module_new            (IDL_tree ident,
  433.                              IDL_tree definition_list);
  434.  
  435. enum IDL_binop {
  436.     IDL_BINOP_OR,
  437.     IDL_BINOP_XOR,
  438.     IDL_BINOP_AND,
  439.     IDL_BINOP_SHR,
  440.     IDL_BINOP_SHL,
  441.     IDL_BINOP_ADD,
  442.     IDL_BINOP_SUB,
  443.     IDL_BINOP_MULT,
  444.     IDL_BINOP_DIV,
  445.     IDL_BINOP_MOD
  446. };
  447.  
  448. struct _IDL_BINOP {
  449.     enum IDL_binop op;
  450.     IDL_tree left, right;
  451. };
  452. #define IDL_BINOP(a)            IDL_CHECK_CAST(a, IDLN_BINOP, idl_binop)
  453. extern IDL_tree        IDL_binop_new            (enum IDL_binop op,
  454.                              IDL_tree left,
  455.                              IDL_tree right);
  456.  
  457. enum IDL_unaryop {
  458.     IDL_UNARYOP_PLUS,
  459.     IDL_UNARYOP_MINUS,
  460.     IDL_UNARYOP_COMPLEMENT
  461. };
  462.  
  463. struct _IDL_UNARYOP {
  464.     enum IDL_unaryop op;
  465.     IDL_tree operand;
  466. };
  467. #define IDL_UNARYOP(a)            IDL_CHECK_CAST(a, IDLN_UNARYOP, idl_unaryop)
  468. extern IDL_tree        IDL_unaryop_new            (enum IDL_unaryop op,
  469.                              IDL_tree operand);
  470.  
  471. /* XPIDL code fragments extension. */
  472. struct _IDL_CODEFRAG {
  473.     char *desc;
  474.     GSList *lines;
  475. };
  476. #define IDL_CODEFRAG(a)            IDL_CHECK_CAST(a, IDLN_CODEFRAG, idl_codefrag)
  477. extern IDL_tree        IDL_codefrag_new        (char *desc,
  478.                              GSList *lines);
  479.  
  480. /*
  481.  * IDL_tree_type - Enumerations of node types
  482.  *
  483.  * Note this enumerator list is subject to change in the future. A program should not need
  484.  * more than a recompilation to adjust for a change in this list, so instead of using a
  485.  * statically initialized jumptable, allocate an array of size IDLN_LAST and assign the
  486.  * elements manually.
  487.  */
  488. typedef enum {
  489.     IDLN_NONE,
  490.     IDLN_ANY,
  491.  
  492.     IDLN_LIST,
  493.     IDLN_GENTREE,
  494.     IDLN_INTEGER,
  495.     IDLN_STRING,
  496.     IDLN_WIDE_STRING,
  497.     IDLN_CHAR,
  498.     IDLN_WIDE_CHAR,
  499.     IDLN_FIXED,
  500.     IDLN_FLOAT,
  501.     IDLN_BOOLEAN,
  502.     IDLN_IDENT,
  503.     IDLN_TYPE_DCL,
  504.     IDLN_CONST_DCL,
  505.     IDLN_EXCEPT_DCL,
  506.     IDLN_ATTR_DCL,
  507.     IDLN_OP_DCL,
  508.     IDLN_PARAM_DCL,
  509.     IDLN_FORWARD_DCL,
  510.     IDLN_TYPE_INTEGER,
  511.     IDLN_TYPE_FLOAT,
  512.     IDLN_TYPE_FIXED,
  513.     IDLN_TYPE_CHAR,
  514.     IDLN_TYPE_WIDE_CHAR,
  515.     IDLN_TYPE_STRING,
  516.     IDLN_TYPE_WIDE_STRING,
  517.     IDLN_TYPE_BOOLEAN,
  518.     IDLN_TYPE_OCTET,
  519.     IDLN_TYPE_ANY,
  520.     IDLN_TYPE_OBJECT,
  521.     IDLN_TYPE_TYPECODE,
  522.     IDLN_TYPE_ENUM,
  523.     IDLN_TYPE_SEQUENCE,
  524.     IDLN_TYPE_ARRAY,
  525.     IDLN_TYPE_STRUCT,
  526.     IDLN_TYPE_UNION,
  527.     IDLN_MEMBER,
  528.     IDLN_NATIVE,
  529.     IDLN_CASE_STMT,
  530.     IDLN_INTERFACE,
  531.     IDLN_MODULE,
  532.     IDLN_BINOP,
  533.     IDLN_UNARYOP,
  534.     IDLN_CODEFRAG,
  535.  
  536.     IDLN_LAST
  537. } IDL_tree_type;
  538. IDL_IMPORT const char *            IDL_tree_type_names[];
  539.  
  540. struct _IDL_tree_node {
  541.     IDL_tree_type _type;
  542.     IDL_tree up;            /* Do not recurse */
  543.     IDL_declspec_t declspec;
  544.     GHashTable *properties;
  545.     int refs;
  546.     char *_file;            /* Internal use */
  547.     int _line;            /* Internal use */
  548.     union {
  549.         struct _IDL_LIST idl_list;
  550.         struct _IDL_GENTREE idl_gentree;
  551.         struct _IDL_INTEGER idl_integer;
  552.         struct _IDL_STRING idl_string;
  553.         struct _IDL_WIDE_STRING idl_wide_string;
  554.         struct _IDL_CHAR idl_char;
  555.         struct _IDL_WIDE_CHAR idl_wide_char;
  556.         struct _IDL_FIXED idl_fixed;
  557.         struct _IDL_FLOAT idl_float;
  558.         struct _IDL_BOOLEAN idl_boolean;
  559.         struct _IDL_IDENT idl_ident;
  560.         struct _IDL_TYPE_DCL idl_type_dcl;
  561.         struct _IDL_CONST_DCL idl_const_dcl;
  562.         struct _IDL_EXCEPT_DCL idl_except_dcl;
  563.         struct _IDL_ATTR_DCL idl_attr_dcl;
  564.         struct _IDL_OP_DCL idl_op_dcl;
  565.         struct _IDL_PARAM_DCL idl_param_dcl;
  566.         struct _IDL_FORWARD_DCL idl_forward_dcl;
  567.         struct _IDL_TYPE_FLOAT idl_type_float;
  568.         struct _IDL_TYPE_FIXED idl_type_fixed;
  569.         struct _IDL_TYPE_INTEGER idl_type_integer;
  570.         struct _IDL_TYPE_ENUM idl_type_enum;
  571.         struct _IDL_TYPE_STRING idl_type_string;
  572.         struct _IDL_TYPE_WIDE_STRING idl_type_wide_string;
  573.         struct _IDL_TYPE_SEQUENCE idl_type_sequence;
  574.         struct _IDL_TYPE_ARRAY idl_type_array;
  575.         struct _IDL_TYPE_STRUCT idl_type_struct;
  576.         struct _IDL_TYPE_UNION idl_type_union;
  577.         struct _IDL_MEMBER idl_member;
  578.         struct _IDL_NATIVE idl_native;
  579.         struct _IDL_CASE_STMT idl_case_stmt;
  580.         struct _IDL_INTERFACE idl_interface;
  581.         struct _IDL_MODULE idl_module;
  582.         struct _IDL_BINOP idl_binop;
  583.         struct _IDL_UNARYOP idl_unaryop;
  584.         struct _IDL_CODEFRAG idl_codefrag;
  585.     } u;
  586.  
  587.     /* Fields for application use */
  588.     guint32 flags;
  589.     gpointer data;
  590. };
  591. #define IDL_NODE_TYPE(a)        ((a)->_type)
  592. #define IDL_NODE_TYPE_NAME(a)        ((a)?IDL_tree_type_names[IDL_NODE_TYPE(a)]:"NULL")
  593. #define IDL_NODE_UP(a)            ((a)->up)
  594. #define IDL_NODE_PROPERTIES(a)        ((a)->properties)
  595. #define IDL_NODE_DECLSPEC(a)        ((a)->declspec)
  596. #define IDL_NODE_REFS(a)        ((a)->refs)
  597. #define IDL_NODE_IS_LITERAL(a)                \
  598.     (IDL_NODE_TYPE(a) == IDLN_INTEGER ||        \
  599.      IDL_NODE_TYPE(a) == IDLN_STRING ||        \
  600.      IDL_NODE_TYPE(a) == IDLN_WIDE_STRING ||    \
  601.      IDL_NODE_TYPE(a) == IDLN_CHAR ||        \
  602.      IDL_NODE_TYPE(a) == IDLN_WIDE_CHAR ||        \
  603.      IDL_NODE_TYPE(a) == IDLN_FIXED ||        \
  604.      IDL_NODE_TYPE(a) == IDLN_FLOAT ||        \
  605.      IDL_NODE_TYPE(a) == IDLN_BOOLEAN)
  606. #define IDL_NODE_IS_TYPE(a)                \
  607.     (IDL_NODE_TYPE(a) == IDLN_TYPE_INTEGER ||    \
  608.      IDL_NODE_TYPE(a) == IDLN_TYPE_STRING ||    \
  609.      IDL_NODE_TYPE(a) == IDLN_TYPE_WIDE_STRING ||    \
  610.      IDL_NODE_TYPE(a) == IDLN_TYPE_CHAR ||        \
  611.      IDL_NODE_TYPE(a) == IDLN_TYPE_WIDE_CHAR ||    \
  612.      IDL_NODE_TYPE(a) == IDLN_TYPE_FIXED ||        \
  613.      IDL_NODE_TYPE(a) == IDLN_TYPE_FLOAT ||        \
  614.      IDL_NODE_TYPE(a) == IDLN_TYPE_BOOLEAN ||    \
  615.      IDL_NODE_TYPE(a) == IDLN_TYPE_OCTET ||        \
  616.      IDL_NODE_TYPE(a) == IDLN_TYPE_ANY ||        \
  617.      IDL_NODE_TYPE(a) == IDLN_TYPE_OBJECT ||    \
  618.      IDL_NODE_TYPE(a) == IDLN_TYPE_TYPECODE ||    \
  619.      IDL_NODE_TYPE(a) == IDLN_TYPE_ENUM ||        \
  620.      IDL_NODE_TYPE(a) == IDLN_TYPE_ARRAY ||        \
  621.      IDL_NODE_TYPE(a) == IDLN_TYPE_SEQUENCE ||    \
  622.      IDL_NODE_TYPE(a) == IDLN_TYPE_STRUCT ||    \
  623.      IDL_NODE_TYPE(a) == IDLN_TYPE_UNION)
  624. #define IDL_NODE_IS_SCOPED(a)                \
  625.     (IDL_NODE_TYPE(a) == IDLN_IDENT ||        \
  626.      IDL_NODE_TYPE(a) == IDLN_INTERFACE ||        \
  627.      IDL_NODE_TYPE(a) == IDLN_MODULE ||        \
  628.      IDL_NODE_TYPE(a) == IDLN_EXCEPT_DCL ||        \
  629.      IDL_NODE_TYPE(a) == IDLN_OP_DCL ||        \
  630.      IDL_NODE_TYPE(a) == IDLN_TYPE_ENUM ||        \
  631.      IDL_NODE_TYPE(a) == IDLN_TYPE_STRUCT ||    \
  632.      IDL_NODE_TYPE(a) == IDLN_TYPE_UNION)
  633.  
  634. typedef struct _IDL_ns *        IDL_ns;
  635.  
  636. struct _IDL_ns {
  637.     IDL_tree global;
  638.     IDL_tree file;
  639.     IDL_tree current;
  640.     GHashTable *inhibits;
  641.     GHashTable *filename_hash;
  642. };
  643. #define IDL_NS(a)            (*(a))
  644.  
  645. typedef enum {
  646.     IDL_INPUT_REASON_INIT,
  647.     IDL_INPUT_REASON_FILL,
  648.     IDL_INPUT_REASON_ABORT,
  649.     IDL_INPUT_REASON_FINISH
  650. } IDL_input_reason;
  651.  
  652. union IDL_input_data {
  653.     struct {
  654.         const char *filename;
  655.     } init;
  656.     struct {
  657.         char *buffer;
  658.         size_t max_size;
  659.     } fill;
  660. };
  661.  
  662. typedef int        (*IDL_input_callback)        (IDL_input_reason reason,
  663.                              union IDL_input_data *data,
  664.                              gpointer user_data);
  665.  
  666. typedef int        (*IDL_msg_callback)        (int level,
  667.                              int num,
  668.                              int line,
  669.                              const char *filename,
  670.                              const char *message);
  671.  
  672. typedef struct _IDL_tree_func_state    IDL_tree_func_state;
  673. typedef struct _IDL_tree_func_data    IDL_tree_func_data;
  674.  
  675. /* Traversal state data.  Recursive walks chain states. */
  676. struct _IDL_tree_func_state {
  677.     IDL_tree_func_state *up;
  678.     IDL_tree start;
  679.     IDL_tree_func_data *bottom;
  680. };
  681.  
  682. /* This holds a list of the up hierarchy traversed, beginning from traversal.  This is
  683.  * useful since nodes referenced after initial definition will have a different traversal
  684.  * path than the actual up path. */
  685. struct _IDL_tree_func_data {
  686.     IDL_tree_func_state *state;
  687.     IDL_tree_func_data *up;
  688.     IDL_tree tree;
  689.     gint step;
  690.     gpointer data;        /* Application data */
  691. };
  692.  
  693. typedef gboolean    (*IDL_tree_func)        (IDL_tree_func_data *tnfd,
  694.                              gpointer user_data);
  695.  
  696. extern IDL_tree        IDL_check_type_cast        (const IDL_tree var,
  697.                              IDL_tree_type type,
  698.                              const char *file,
  699.                              int line,
  700.                              const char *function);
  701.  
  702. extern const char *    IDL_get_libver_string        (void);
  703.  
  704. extern const char *    IDL_get_IDLver_string        (void);
  705.  
  706. extern int        IDL_parse_filename        (const char *filename,
  707.                              const char *cpp_args,
  708.                              IDL_msg_callback msg_cb,
  709.                              IDL_tree *tree, IDL_ns *ns,
  710.                              unsigned long parse_flags,
  711.                              int max_msg_level);
  712.  
  713. extern int        IDL_parse_filename_with_input    (const char *filename,
  714.                              IDL_input_callback input_cb,
  715.                              gpointer input_cb_user_data,
  716.                              IDL_msg_callback msg_cb,
  717.                              IDL_tree *tree, IDL_ns *ns,
  718.                              unsigned long parse_flags,
  719.                              int max_msg_level);
  720.  
  721. extern int        IDL_ns_prefix            (IDL_ns ns,
  722.                              const char *s);
  723.  
  724. extern void        IDL_ns_ID            (IDL_ns ns,
  725.                              const char *s);
  726.  
  727. extern void        IDL_ns_version            (IDL_ns ns,
  728.                              const char *s);
  729.  
  730. extern int        IDL_inhibit_get            (void);
  731.  
  732. extern void        IDL_inhibit_push        (void);
  733.  
  734. extern void        IDL_inhibit_pop            (void);
  735.  
  736. extern void        IDL_file_set            (const char *filename,
  737.                              int line);
  738.  
  739. extern void        IDL_file_get            (const char **filename,
  740.                              int *line);
  741.  
  742. extern IDL_tree        IDL_get_parent_node        (IDL_tree p,
  743.                              IDL_tree_type type,
  744.                              int *scope_levels);
  745.  
  746. extern IDL_tree        IDL_tree_get_scope        (IDL_tree p);
  747.  
  748. extern int        IDL_tree_get_node_info        (IDL_tree tree,
  749.                              char **who,
  750.                              char **what);
  751.  
  752. extern void        IDL_tree_error            (IDL_tree p,
  753.                              const char *fmt,
  754.                              ...)
  755.                             G_GNUC_PRINTF (2, 3);
  756.  
  757. extern void        IDL_tree_warning        (IDL_tree p,
  758.                              int level,
  759.                              const char *fmt,
  760.                              ...)
  761.                             G_GNUC_PRINTF (3, 4);
  762.  
  763. extern const char *    IDL_tree_property_get        (IDL_tree tree,
  764.                              const char *key);
  765.  
  766. extern void        IDL_tree_property_set        (IDL_tree tree,
  767.                              const char *key,
  768.                              const char *value);
  769.  
  770. extern gboolean        IDL_tree_property_remove    (IDL_tree tree,
  771.                              const char *key);
  772.  
  773. extern void        IDL_tree_properties_copy    (IDL_tree from_tree,
  774.                              IDL_tree to_tree);
  775.  
  776. extern void        IDL_tree_remove_inhibits    (IDL_tree *tree,
  777.                              IDL_ns ns);
  778.  
  779. extern void        IDL_tree_walk            (IDL_tree p,
  780.                              IDL_tree_func_data *current,
  781.                              IDL_tree_func pre_tree_func,
  782.                              IDL_tree_func post_tree_func,
  783.                              gpointer user_data);
  784.  
  785. extern void        IDL_tree_walk_in_order        (IDL_tree p,
  786.                              IDL_tree_func tree_func,
  787.                              gpointer user_data);
  788.  
  789. extern void        IDL_tree_free            (IDL_tree root);
  790.  
  791. extern void        IDL_tree_to_IDL            (IDL_tree p,
  792.                              IDL_ns ns,
  793.                              FILE *output,
  794.                              unsigned long output_flags);
  795.  
  796. extern GString *    IDL_tree_to_IDL_string        (IDL_tree p,
  797.                              IDL_ns ns,
  798.                              unsigned long output_flags);
  799.  
  800. extern gchar *        IDL_do_escapes            (const char *s);
  801.  
  802. extern IDL_tree        IDL_resolve_const_exp        (IDL_tree p,
  803.                              IDL_tree_type type);
  804.  
  805. extern IDL_ns        IDL_ns_new            (void);
  806.  
  807. extern void        IDL_ns_free            (IDL_ns ns);
  808.  
  809. extern IDL_tree        IDL_ns_resolve_this_scope_ident    (IDL_ns ns,
  810.                              IDL_tree scope,
  811.                              IDL_tree ident);
  812.  
  813. extern IDL_tree        IDL_ns_resolve_ident        (IDL_ns ns,
  814.                              IDL_tree ident);
  815.  
  816. extern IDL_tree        IDL_ns_lookup_this_scope    (IDL_ns ns,
  817.                              IDL_tree scope,
  818.                              IDL_tree ident,
  819.                              gboolean *conflict);
  820.  
  821. extern IDL_tree        IDL_ns_lookup_cur_scope        (IDL_ns ns,
  822.                              IDL_tree ident,
  823.                              gboolean *conflict);
  824.  
  825. extern IDL_tree        IDL_ns_place_new        (IDL_ns ns,
  826.                              IDL_tree ident);
  827.  
  828. extern void        IDL_ns_push_scope        (IDL_ns ns,
  829.                              IDL_tree ident);
  830.  
  831. extern void        IDL_ns_pop_scope        (IDL_ns ns);
  832.  
  833. extern IDL_tree        IDL_ns_qualified_ident_new    (IDL_tree nsid);
  834.  
  835. extern gchar *        IDL_ns_ident_to_qstring        (IDL_tree ns_ident,
  836.                              const char *join,
  837.                              int scope_levels);
  838.  
  839. extern int        IDL_ns_scope_levels_from_here    (IDL_ns ns,
  840.                              IDL_tree ident,
  841.                              IDL_tree parent);
  842.  
  843. extern gchar *        IDL_ns_ident_make_repo_id    (IDL_ns ns,
  844.                              IDL_tree p,
  845.                              const char *p_prefix,
  846.                              int *major,
  847.                              int *minor);
  848.  
  849. #ifdef __cplusplus
  850. }
  851. #endif
  852.  
  853. #endif /* __IDL_H */
  854.